import unittest
import time


class TestDateMethods(unittest.TestCase):

    def test_get_now(self):
        # 获取当前时间戳
        print(time.time())
        # 将时间戳转换为本地时间
        print(time.localtime(time.time()))

    def test_format(self):
        # 将时间格式化为常用的字符串类型
        print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))


if __name__ == '__main__':
    unittest.main()
